#!/bin/sh
#SBATCH --partition=valhalla
#SBATCH --clusters=chemistry
#SBATCH --time=00:20:00
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4
#SBATCH --mem=5000
#SBATCH --mail-user=alexeyak@buffalo.edu

echo "SLURM_JOBID="$SLURM_JOBID
echo "SLURM_JOB_NODELIST="$SLURM_JOB_NODELIST
echo "SLURM_NNODES="$SLURM_NNODES
echo "SLURMTMPDIR="$SLURMTMPDIR
echo "working directory="$SLURM_SUBMIT_DIR

NPROCS=`srun --nodes=${SLURM_NNODES} bash -c 'hostname' |wc -l`
echo NPROCS=$NPROCS

module load intel/16.0
module load intel-mpi/5.1.1
module load mkl/11.3
module load espresso


#The PMI library is necessary for srun
export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi.so






# Setup all manual parameters here
# Must be ABSOLUTE paths
NP=4
exe_qespresso=/util/academic/espresso/espresso-5.2.1/bin/pw.x
exe_export=/util/academic/espresso/espresso-5.2.1/bin/pw_export.x
exe_convert=/util/academic/espresso/espresso-5.2.1/bin/iotk
res=/projects/academic/alexeyak/alexeyak/pyxaid-code/tutorials/Tut2_small/step2/res

# These will be assigned automatically, leave them as they are
param1=
param2=


# This is invocation of the scripts which will further handle NA-MD calclculations
# on the NAC calculation step
python -c "from PYXAID import *
params = { }
params[\"NP\"]=$NP
params[\"EXE\"]=\"$exe_qespresso\"
params[\"EXE_EXPORT\"]=\"$exe_export\"
params[\"EXE_CONVERT\"] = \"$exe_convert\"
params[\"start_indx\"]=$param1
params[\"stop_indx\"]=$param2	
params[\"wd\"]=\"wd_test\"
params[\"rd\"]=\"$res\"
params[\"minband\"]=4
params[\"nocc\"]=6
params[\"maxband\"]=10
params[\"nac_method\"]=0
params[\"wfc_preprocess\"]=\"complete\"
params[\"do_complete\"]=1
params[\"prefix0\"]=\"x0.scf\"
params[\"prefix1\"]=\"x1.scf\"
params[\"compute_Hprime\"]=0
print params
runMD1.runMD(params)
"


